<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="$!webPath/css/template.css"  rel="stylesheet" type="text/css">
    <link href="$!webPath/css/jquery-ui-1.8.22.custom.css" type=text/css rel=stylesheet>
    <script src="$!webPath/js/jquery-1.6.2.js"></script>
    <script src="$!webPath/js/jquery-ui-1.8.21.js"></script>
</head>
<body>
<div class="header_nav">
    <iframe name="content_frame" src="$!webPath/admin/nav" marginwidth=0 marginheight=0  frameborder=0 width=100% height=80/></iframe>
    <div class="cont_right"><a href="$!webPath/login">注销</a></div>
</div>
<div class="cont">
    <h3 class="seth">用户管理</h3>
    <div class="nav_list">
        <ul>
            <li><a href="$!webPath/admin/list_all_user?size=10&page=0" class="this"><b>用户列表</b></a></li>
        </ul>
    </div>
    <form action="$!webPath/admin/" method="post" id="ListForm" >
        <div class="fshoptb">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="fshop_table">
                <tr>
                    <th width="" align="center">昵称</th>
                    <th width="" align="center">用户名</th>
                    <th width="" align="center">手机号</th>
                    <th width="" align="center">战队身份</th>
                    <th width="" align="center">所属战队</th>
                    <th width="" align="center">创建时间</th>
                    <th width="" align="center">更新时间</th>
                    <th width="" align="center">创建人</th>
                    <th width="" align="center">更新人</th>
                    <th width="" align="center">状态</th>
                    <th align="center">操作</th>
                </tr>
                <tbody id="user_list">
                #foreach($obj in $!users)
                <tr>
                    #if($!obj.nickname)
                    <td align="center">$!obj.nickname</td>
                    #else
                    <td align="center">$!obj.userWxNickname</td>
                    #end
                    <td align="center">$!obj.userName</td>
                    <td align="center">
                    #if($!obj.mobile)
                    $!obj.mobile
                    #else
                    暂无
                    #end
                    </td>
                    #if($!obj.isCaption==0)
                    <td align="center">队员</td>
                    #elseif($!obj.isCaption==1)
                    <td align="center">队长</td>
                    #end
                    <td align="center">
                        #if($!obj.teamEntity.name)
                        $!obj.teamEntity.name
                        #else
                        暂无
                        #end
                    </td>
                    <td align="center">$!obj.createdAt</td>
                    <td align="center">$!obj.updateAt</td>
                    <td align="center">$!obj.createdBy</td>
                    <td align="center">$!obj.updateBy</td>
                    #if($!obj.userStatus==0)
                    <td align="center">未激活</td>
                    #else
                    <td align="center">已激活</td>
                    #end
                    <td align="center" class="hui oprate_con">
                        <a href="$!webPath/admin/user_details?userId=$!obj.id" class="blue">修改状态</a>
                    </td>
                </tr>
                #end
                </tbody>
            </table>
            <span id="spanFirst">第一页</span> <span id="spanPre">上一页</span> <span id="spanNext">下一页</span>
        </div>
        <div class="operate_bar">
            <div class="fenye">
                $!gotoPageFormHTML
            </div>
        </div>
    </form>
</div>
<script>

    getUrlParam = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }

    //替换指定传入参数的值,paramName为参数,replaceWith为新值
    function replaceParamVal(paramName,replaceWith) {
        var oUrl = this.location.href.toString();
        var re=eval('/('+ paramName+'=)([^&]*)/gi');
        var nUrl = oUrl.replace(re,paramName+'='+replaceWith);
        this.location = nUrl;
    }
    var pageSize = getUrlParam('size');
    var page = getUrlParam('page');
    $('#spanFirst').click(function () {
        page=0
        $.ajax({
            url:'$!webPath/admin/list_all_user?size=10&page='+page,
            success:function(data){
                console.log(data);
                window.location.href='$!webPath/admin/list_all_user?size=10&page='+page;
                replaceParamVal('page',page);
            }
        })
    })
    $('#spanNext').click(function(){
        page++;
        $.ajax({
            url:'$!webPath/admin/list_all_user?size=10&page='+page,
            success:function(data){
                console.log(data);
                window.location.href='$!webPath/admin/list_all_user?size=10&page='+page;
                replaceParamVal('page',page);
            }
        })
    })

    $('#spanPre').click(function(){
        page--;
        if(page<=0){
            page=0;
        }
        $.ajax({
            url:'$!webPath/admin/list_all_user?size=10&page='+page,
            success:function(data){
                console.log(data);
                window.location.href='$!webPath/admin/list_all_user?size=10&page='+page;
                replaceParamVal('page',page);
            }
        })
    })
</script>
</body>
</html>
